<template>
	<view>
		<list class="record_list">
			<cell class="record_item" v-for="(item,index) in dataList">
				<view class="top_div">
					<view class="left_div">
						章
					</view>
					<view class="right_div">
						<view>{{item.title}}</view>
						<view><!-- {{item.timeStr}} --> 总共:{{item.answerNum}}道题 做对:{{item.rightNum}}题</view>
					</view>

				</view>
				<view class="bottom_div">
					<view class="bottom_item" @click="againMake(item.chapterId)">
						<image src="../../static/ztjl_zt_on.png"></image>
						<text>重做</text>
					</view>
					<view class="bottom_item"  @click="lookAnalysis(item.targetId)">
						<image src="../../static/ztjl_ckjx.png"></image>
						<text>查看解析</text>
					</view>
					<view class="bottom_item" @click="reportForm(item.chapterId)">
						<image src="../../static/ztjl_bg_on.png"></image>
						<text>报告</text>
					</view>
				</view>
			</cell>
		</list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				 dataList: [ 
				// 		{"id": 1,
				// 		"name": "数据类型和变量",
				// 		timeStr: "1小时前",
				// 		"allCount": 30,
				// 		"succCount": 10,
				// 		"chapterId": 1//所属章节
				// 	},
				// 	{
				// 		"id": 2,
				// 		"name": "分支流程",
				// 		timeStr: "1小时前",
				// 		"allCount": 20,
				// 		"succCount": 13,
				// 		"chapterId": 5
				// 	}
				 ]
			}
		},onReady:function(){
			this.currCourse=uni.getStorageSync('cname');
			console.log(this.currCourse); 
				uni.request({
					url: this.baseUrl+'getPracticeResultList', //仅为示例，并非真实接口地址。
					method:'POST',
					data: {
						stuId: uni.getStorageSync('uid')
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
					},
					success: (res) => {
						console.log(res);
						this.dataList = res.data.practiceResults;
						this.text = 'request success';
					}
				});
			},
		methods:{
			againMake:function(ind){
				//重做
				uni.navigateTo({
					url: '../chapterquestion/chapterquestion?id=' + ind
				});
			},
			lookAnalysis:function(ind){
				//查看解析
				uni.navigateTo({
					url: '../answeranalysis/answeranalysis?id=' + ind
				});
			},
			reportForm:function(ind){
				//报告
				uni.navigateTo({
					url: '../reportForm/reportForm?id=' + ind
				});
			},
		}
	}
</script>

<style>
	.record_list {
		width: 100%;
	}

	.record_list .record_item {
		background: #FFFFFF;
		display: block;
		margin-top: 20rpx;
	}

	.record_list .record_item .top_div {
		display: flex;
		padding-left: 26rpx;
		padding-right: 26rpx;
		padding-top: 26rpx;
	}

	.record_list .record_item .top_div .left_div {
		background: url(../../static/bg_classify_box_b.png);
		background-size: 100%;

		width: 70rpx;
		height: 70rpx;
		font-size: 26rpx;
		color: #333333;
		text-align: center;
		line-height: 70rpx;
		margin-right: 26rpx;
	}

	.record_list .record_item .top_div .right_div view:nth-child(1) {
		margin-top: 10rpx;
		font-size: 28rpx;
		color: #333333;
	}

	.record_list .record_item .top_div .right_div view:nth-child(2) {
		margin-top: 26rpx;
		font-size: 24rpx;
		color: #666666;
	}

	.record_list .record_item .bottom_div {
		display: flex;
		height: 80rpx;
		align-items: center;
		margin-top: 26rpx;
		border-top: 1px solid #DADADA;

	}

	.record_list .record_item .bottom_div .bottom_item {
		flex: 1;
		font-size: 24rpx;
		color: #333333;
		text-align: center;
		border-right: 1px solid #DADADA;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.record_list .record_item .bottom_div .bottom_item image {
		width: 24rpx;
		height: 24rpx;
	}
	.record_list .record_item .bottom_div .bottom_item text{
		margin-left: 10rpx;
	}
</style>
